<?php
/* @var $this EventController */
/* @var $model Event */
/* @var $form CActiveForm */
?>
<div id="update_form">
<!-- form start -->

<div class="zyWell">Fields with<span class="required">*</span>are required.</div>

<?php $form=$this->beginWidget('CActiveForm', array(
	'id'=>'event-form',
	'enableAjaxValidation'=>false,
	'htmlOptions'=>array('enctype'=>'multipart/form-data'),
)); ?>
<?php echo $form->errorSummary($model); ?>

	<div class="row-fluid">
		<div class="span6">
			<div class="form-row control-group row-fluid">
				<?php echo $form->labelEx($model,'event_title'); ?>
					<div class="controls span7">
						<?php echo $form->textField($model,'event_title',array('size'=>60,'maxlength'=>255)); ?>
						<?php echo $form->error($model,'event_title'); ?>
					</div>
			</div>
		</div>
		<div class="span6">
			<div class="form-row control-group row-fluid">
				<?php echo $form->labelEx($model,'event_content'); ?>
					<div class="controls span7">
						<?php echo $form->textField($model,'event_content',array('size'=>60,'maxlength'=>255)); ?>
						<?php echo $form->error($model,'event_content'); ?>
					</div>
			</div>
		</div>
	</div>
	<div class="row-fluid">
		<div class="span6">
			<div class="form-row control-group row-fluid">
				<?php echo $form->labelEx($model,'start_time'); ?>
					<div class="controls span7">
					<input type="text" id="Event_start_time" name="Event[start_time]" size="60"  value="<?php echo $model->start_time=='0000-00-00 00:00:00'?date("Y-m-d H:i:s",strtotime("+7 days")):$model->start_time;?>" onClick="WdatePicker({startDate:'%y-%M-01 00:00:00',dateFmt:'yyyy-MM-dd HH:mm:ss',alwaysUseStartDate:true})" " style="width:300px;" />
						<?php //echo $form->textField($model,'start_time'); ?>
						
						<?php echo $form->error($model,'start_time'); ?>
					</div>
			</div>
		</div>
				<div class="span6">
			<div class="form-row control-group row-fluid">
				<?php echo $form->labelEx($model,'end_time'); ?>
					<div class="controls span7">
					<input type="text" id="Event_end_time" name="Event[end_time]" size="60"  value="<?php echo $model->end_time=='0000-00-00 00:00:00'?date("Y-m-d H:i:s",strtotime("+7 days")):$model->end_time;?>" onClick="WdatePicker({startDate:'%y-%M-01 00:00:00',dateFmt:'yyyy-MM-dd HH:mm:ss',alwaysUseStartDate:true})" " style="width:300px;" />
						<?php //echo $form->textField($model,'end_time'); ?>
						<?php echo $form->error($model,'end_time'); ?>
					</div>
			</div>
		</div>
	</div>
	<div class="row-fluid">
		<div class="span6">
			<div class="form-row control-group row-fluid">
				<?php echo $form->labelEx($model,'award_expiry_date'); ?>
					<div class="controls span7">
					<input type="text" id="Event_award_expiry_date" name="Event[award_expiry_date]" size="60"  value="<?php echo $model->award_expiry_date=='0000-00-00 00:00:00'?date("Y-m-d H:i:s",strtotime("+7 days")):$model->award_expiry_date;?>" onClick="WdatePicker({startDate:'%y-%M-01 00:00:00',dateFmt:'yyyy-MM-dd HH:mm:ss',alwaysUseStartDate:true})" " style="width:300px;" />
						<?php //echo $form->textField($model,'award_expiry_date'); ?>
						<?php echo $form->error($model,'award_expiry_date'); ?>
					</div>
			</div>
		</div>
				<div class="span6">
			<div class="form-row control-group row-fluid">
				<?php echo $form->labelEx($model,'prize_qty'); ?>
					<div class="controls span7">
						<?php echo $form->textField($model,'prize_qty'); ?>
						<?php echo $form->error($model,'prize_qty'); ?>
					</div>
			</div>
		</div>
	</div>
	<div class="row-fluid">
		<div class="span6">
			<div class="form-row control-group row-fluid">
				<?php echo $form->labelEx($model,'event_banael'); ?>
				
					<?php if($model->event_id==null){?>
					<div class="controls span7">
						<?php echo $form->fileField($model,'event_banael',array('size'=>60,'maxlength'=>255,'value'=>$model->event_banael)); ?>
						<?php echo $form->error($model,'event_banael'); ?>
					</div>
					<?php }else{?>
						<div class="controls span7">
						<input type="text" name="event_banael" value="<?php echo $model->event_banael;?>" readonly=true/>
						<?php echo $form->fileField($model,'event_banael',array('size'=>60,'maxlength'=>255,'value'=>$model->event_banael)); ?>
						<?php echo $form->error($model,'event_banael'); ?>
					</div>
						<?php }?>
			</div>
		</div>
		
			<div class="span6">
			<div class="form-row control-group row-fluid">
				<?php echo $form->labelEx($model,'user_id'); ?>
					<div class="controls span7">
						<?php echo $form->dropDownList($model,'user_id',Event::model()->getPartners()); ?>
						<?php echo $form->error($model,'user_id'); ?>
					</div>
			</div>
		</div>
	</div>
	<div class="row-fluid">
		<div class="span6">
			<div class="form-row control-group row-fluid">
				<?php echo $form->labelEx($model,'winning_email_cn'); ?>
					<div class="controls span7">
						<?php echo $form->textArea($model,'winning_email_cn',array('size'=>60,'class'=>'autogrow','style'=>'overflow-x:auto;overflow-y:auto;width: 750px; height: 500px;')); ?>
						<?php echo $form->error($model,'winning_email_cn'); ?>
					</div>
			</div>
		</div>
		</div>
		<div class="row-fluid">
			<div style="margin-left:170px;">
				<input type="button" name="mail_cn_lastName" value="<?php echo Yii::t('event','LastName')?>" id="mail_cn_lastName"/>
				<input type="button" name="mail_cn_firstName" value="<?php echo Yii::t('event','FirstName')?>" id="mail_cn_firstName"/>
				<input type="button" name="mail_cn_awardCode" value="<?php echo Yii::t('event','AwardCode')?>" id="mail_cn_awardCode"/>
				<input type="button" name="mail_cn_awardAddress" value="<?php echo Yii::t('event','AwardAddress')?>" id="mail_cn_awardAddress"/>
			</div>
			</div>
		<div class="row-fluid">
		<div class="span6">
			<div class="form-row control-group row-fluid">
				<?php echo $form->labelEx($model,'winning_email_en'); ?>
					<div class="controls span7">
						<?php echo $form->textArea($model,'winning_email_en',array('size'=>60,'class'=>'autogrow','style'=>'overflow-x:auto;overflow-y:auto;width: 750px; height: 500px;')); ?>
						<?php echo $form->error($model,'winning_email_en'); ?>
					</div>
			</div>
		</div>
	</div>
	<div class="row-fluid">
			<div style="margin-left:170px;">
				<input type="button" name="mail_en_lastName" value="<?php echo Yii::t('event','LastName')?>" id="mail_en_lastName"/>
				<input type="button" name="mail_en_firstName" value="<?php echo Yii::t('event','FirstName')?>" id="mail_en_firstName"/>
				<input type="button" name="mail_en_awardCode" value="<?php echo Yii::t('event','AwardCode')?>" id="mail_en_awardCode"/>
				<input type="button" name="mail_en_awardAddress" value="<?php echo Yii::t('event','AwardAddress')?>" id="mail_en_awardAddress"/>
			</div>
	</div>
			
	<div class="row-fluid">
		<div class="span6">
			<div class="form-row control-group row-fluid">
				<?php echo $form->labelEx($model,'winning_sms_cn'); ?>
					<div class="controls span7">
						<?php echo $form->textArea($model,'winning_sms_cn',array('size'=>60,'class'=>'autogrow','style'=>'overflow-x:auto;overflow-y:auto;width: 750px; height: 100px;')); ?>
						<?php echo $form->error($model,'winning_sms_cn'); ?>
					</div>
			</div>
		</div>
	</div>
	<div class="row-fluid">
			<div style="margin-left:170px;">
				<input type="button" name="sms_cn_lastName" value="<?php echo Yii::t('event','LastName')?>" id="sms_cn_lastName"/>
				<input type="button" name="sms_cn_firstName" value="<?php echo Yii::t('event','FirstName')?>" id="sms_cn_firstName"/>
				<input type="button" name="sms_cn_awardCode" value="<?php echo Yii::t('event','AwardCode')?>" id="sms_cn_awardCode"/>
				<input type="button" name="sms_cn_awardAddress" value="<?php echo Yii::t('event','AwardAddress')?>" id="sms_cn_awardAddress"/>
			</div>
	</div>
	<div class="row-fluid">
		<div class="span6">
			<div class="form-row control-group row-fluid">
				<?php echo $form->labelEx($model,'winning_sms_en'); ?>
					<div class="controls span7">
						<?php echo $form->textArea($model,'winning_sms_en',array('size'=>60,'class'=>'autogrow','style'=>'overflow-x:auto;overflow-y:auto;width: 750px; height: 100px;')); ?>
						<?php echo $form->error($model,'winning_sms_en'); ?>
					</div>
			</div>
		</div>
	</div>
	<div class="row-fluid">	
			<div style="margin-left:170px;">
				<input type="button" name="sms_en_lastName" value="<?php echo Yii::t('event','LastName')?>" id="sms_en_lastName"/>
				<input type="button" name="sms_en_firstName" value="<?php echo Yii::t('event','FirstName')?>" id="sms_en_firstName"/>
				<input type="button" name="sms_en_awardCode" value="<?php echo Yii::t('event','AwardCode')?>" id="sms_en_awardCode"/>
			<input type="button" name="sms_en_awardAddress" value="<?php echo Yii::t('event','AwardAddress')?>" id="sms_en_awardAddress"/>
			</div>
	</div>
	<div class="row-fluid">
		<div class="span6">
			<div class="form-row control-group row-fluid">
				<?php //echo $form->labelEx($model,'update_user'); ?>
					<div class="controls span7">
						<?php //echo $form->textField($model,'update_user',array('size'=>60,'maxlength'=>255)); ?>
						<?php //echo $form->error($model,'update_user'); ?>
					</div>
			</div>
		</div>
<div class="form-actions row-fluid">
	<div class="span7 offset3">
		<?php echo CHtml::submitButton($model->isNewRecord ? Yii::t("common","Create") : Yii::t("common","Save"),array('class'=>'btn btn-large btn-block')); ?>
	</div>
</div>
<?php $this->endWidget(); ?>
</div>
<!-- form -->
<?php 
Yii :: app()->clientScript->registerScript('search', "
	   $('#mail_cn_lastName').click(function(){
        $('#Event_winning_email_cn').insertAtCaret('{lastName}');   
   		 }); 
   		 $('#mail_cn_firstName').click(function(){
        $('#Event_winning_email_cn').insertAtCaret('{firstName}');   
   		 });
   		 $('#mail_cn_awardCode').click(function(){
        $('#Event_winning_email_cn').insertAtCaret('{awardCode}');   
   		 });
   		 $('#mail_cn_awardAddress').click(function(){
        $('#Event_winning_email_cn').insertAtCaret('{awardAddress}');   
   		 });
   		  $('#mail_en_lastName').click(function(){
        $('#Event_winning_email_en').insertAtCaret('{lastName}');   
   		 }); 
   		 $('#mail_en_firstName').click(function(){
        $('#Event_winning_email_en').insertAtCaret('{firstName}');   
   		 });
   		 $('#mail_en_awardCode').click(function(){
        $('#Event_winning_email_en').insertAtCaret('{awardCode}');   
   		 });
   		  $('#mail_en_awardAddress').click(function(){
        $('#Event_winning_email_en').insertAtCaret('{awardAddress}');   
   		 }); 
   		 		
   		 $('#sms_cn_lastName').click(function(){
        $('#Event_winning_sms_cn').insertAtCaret('{lastName}');   
   		 }); 
   		 $('#sms_cn_firstName').click(function(){
        $('#Event_winning_sms_cn').insertAtCaret('{firstName}');   
   		 });
   		 $('#sms_cn_awardCode').click(function(){
        $('#Event_winning_sms_cn').insertAtCaret('{awardCode}');   
   		 });
   		  $('#sms_cn_awardAddress').click(function(){
        $('#Event_winning_sms_cn').insertAtCaret('{awardAddress}');   
   		 });
   		  $('#sms_en_lastName').click(function(){
        $('#Event_winning_sms_en').insertAtCaret('{lastName}');   
   		 }); 
   		 $('#sms_en_firstName').click(function(){
        $('#Event_winning_sms_en').insertAtCaret('{firstName}');   
   		 });
   		 $('#sms_en_awardCode').click(function(){
        $('#Event_winning_sms_en').insertAtCaret('{awardCode}');   
   		 });
   		  $('#sms_en_awardAddress').click(function(){
        $('#Event_winning_sms_en').insertAtCaret('{awardAddress}');   
   		 });	
			");
?>